<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('代理政策列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <input type="hidden" name="agentNum" th:value="${agentNum}"/>
                    <div class="select-list">
                        <ul>
                            <li>
                                <label style="width: 100px;">政策编号：</label>
                                <input type="text" name="actId"/>
                            </li>
                            <li>
                                <label style="width: 10px;"></label>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-primary single disabled" onclick="editPrice()" shiro:hasPermission="agentInfo:agentInfo:editAgentPriceCz">
                    <i class="fa fa-edit"></i> 设置结算
                </a>
                <a class="btn btn-primary single disabled" onclick="editLc()" shiro:hasPermission="agentInfo:agentInfo:lc">
                    <i class="fa fa-edit"></i> 设置留存
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table" class="table text-nowrap"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('agentInfo:agentActActive:edit')}]];
        var removeFlag = [[${@permission.hasPermi('agentInfo:agentActActive:remove')}]];
        var prefix = ctx + "agentInfo/agentActActive";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "代理政策",
                clickToSelect:true,
                columns: [{
                    radio: true
                },
                {
                    field: 'agentNum',
                    title: '代理商编号'
                },
                {
                    field: 'actId',
                    title: '政策编号'
                },
                {
                    field: 'actName',
                    title: '政策名称'
                },
                /*{
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }*/]
            };
            $.table.init(options);
        });

        /**
         * 设置结算
         */
        function editPrice() {
            var id = $.table.selectColumns("id");
            $.modal.open("设置结算", prefix + "/editPrice?id="+id,"1100","600");
        }

        function editLc() {
            var actId = $.table.selectColumns("actId");
            var agentNum = $.table.selectColumns("agentNum");
            $.modal.open("设置留存", prefix + "/editLc?actId="+actId + "&agentNum=" + agentNum ,"1100","600");
        }

    </script>
</body>
</html>